- var fontawesomeInputName = "sign-in-alt";
- var fontawesomeOutputName = "sign-out-alt";

- var totalIOValues = utils.getTxTotalInputOutputValues(tx, txInputs, blockHeight);

script.
	function showAllTxOutputs(link, txid) {
		var hiddenRows = document.querySelectorAll("[data-txid='" + txid + "']");
		hiddenRows.forEach(function(hiddenRow) {
			hiddenRow.classList.remove("d-none");
		});

		link.classList.add("d-none");
	}

div.row.text-monospace
	div.col-lg-6
		if (txInputs)
			- var extraInputCount = 0;
			each txVin, txVinIndex in tx.vin
				if (!txVin.coinbase)
					- var vout = null;
					if (txInputs && txInputs[txVinIndex])
						- var txInput = txInputs[txVinIndex];
						- var vout = txInput;

				if (txVin.coinbase || vout)
					div.clearfix
						div.tx-io-label
							a(data-toggle="tooltip", title=("Input #" + txVinIndex.toLocaleString()), style="white-space: nowrap;")
								span.font-weight-bold &gt; 
								small.d-inline.d-md-none Input 
								
								if (tx.vin.length > 999)
									small.word-wrap ##{txVinIndex}
								else
									span ##{txVinIndex.toLocaleString()}
									
								if (tx.vin.length > 0)
									small.d-inline.d-md-none.font-weight-light.text-muted  / #{(tx.vin.length - 1).toLocaleString()}

						div.tx-io-content
							div.clearfix
								div.tx-io-desc
									if (txVin.coinbase)
										small.data-tag.bg-success.mr-2(title="Coinbase transactions are special transactions created by the miner of a block. They distribute the block reward (subsidy) as the miner chooses, along with all of the fees paid by transactions included in the block.", data-toggle="tooltip") coinbase
										
										div.pt-1
											small.font-weight-bold(tistle="ASCII encoded", data-toggle="tooltip") data
											small (ascii) - 
											small #{utils.hex2ascii(txVin.coinbase)}
											br
											small
												a(href="javascript:void(0)" onclick="$('#coinbase-data-hex').show(); $(this).hide(); return false;") show raw

										div(id="coinbase-data-hex", style="display: none;")
											small.font-weight-bold data
											small (hex) - 
											small.word-wrap #{txVin.coinbase}


									else
										div.word-wrap
											small.data-tag.bg-dark.mr-2
												span(title=`Input Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-toggle="tooltip") #{utils.outputTypeAbbreviation(vout.scriptPubKey.type)}

											if (vout.coinbaseSpend)
												small.data-tag.bg-success.mr-2
													span(title=`This input spends a coinbase output (mining reward).`, data-toggle="tooltip") coinbase-spend

											if (vout.utxoTime)
												- var deltaT = tx.time - vout.utxoTime
												- var deltaTYears = deltaT / 60 / 60 / 24 / 365

												if (deltaTYears > 5)
													span.mr-2(title=`This UTXO was very old! It existed for ${parseInt(deltaTYears)}+ years - from ${moment.utc(new Date(vout.utxoTime * 1000)).format('MMM D, Y')} until ${moment.utc(new Date(tx.time * 1000)).format('MMM D, Y')} - before being spent (destroyed) in this transaction!`, data-toggle="tooltip")
														i.fas.fa-certificate.text-primary
												
											
											a(href=("./tx/" + txInput.txid + "#output-" + txVin.vout)) #{utils.ellipsize(txInput.txid, 26)}
												span  ##{txVin.vout}

										if (vout && vout.scriptPubKey && vout.scriptPubKey.addresses)
											div.word-wrap
												small.text-muted
													span.mr-1 (addr:
													a(href=("./address/" + vout.scriptPubKey.addresses[0]), class=(txIOHighlightAddress == vout.scriptPubKey.addresses[0] ? "font-weight-bold" : null)) #{vout.scriptPubKey.addresses[0]}

													if (global.specialAddresses[vout.scriptPubKey.addresses[0]])
														- var specialAddressInfo = global.specialAddresses[vout.scriptPubKey.addresses[0]];
														if (specialAddressInfo.type == "minerPayout")
															span  
															a(data-toggle="tooltip", title=("Miner payout address: " + specialAddressInfo.minerInfo.name))
																i.fas.fa-certificate.text-primary

													span )

											if (false)
												small
													span.border-dotted(title="Transaction output", data-toggle="tooltip") txo
													span.mr-1 :
													a(href=("./tx/" + txInput.txid + "#output-" + txVin.vout)) #{utils.ellipsize(txInput.txid, 20)}[#{txVin.vout}]

										else
											


								div.tx-io-value
									if (txVin.coinbase)
										- var currencyValue = coinConfig.blockRewardFunction(blockHeight, activeBlockchain);
										include ./value-display.pug
									else
										if (vout && vout.value)
											- var currencyValue = vout.value;
											include ./value-display.pug

					hr

				else
					- extraInputCount = extraInputCount + 1;

			if (extraInputCount > 0)
				div.clearfix
					div.tx-io-label
						a(data-toggle="tooltip", title=("Input #" + (tx.vin.length - extraInputCount + 1).toLocaleString() + " - " + tx.vin.length.toLocaleString()), style="white-space: nowrap;")
							span.font-weight-bold &gt; 
							span.d-inline.d-md-none Input 
							span #…

					div.tx-io-content
						div.clearfix
							div.tx-io-desc
								span.text-reset #{extraInputCount.toLocaleString()} more input
									if (extraInputCount > 1)
										span s
								br
								small.text-muted (see 
									a(href=("./tx/" + tx.txid)) transaction page
									span  for details)

							div.tx-io-value
								- var currencyValue = new Decimal(totalIOValues.output).minus(new Decimal(totalIOValues.input));
								include ./value-display.pug
				hr

			div.row.mb-5.mb-lg-0
				div.col
					div.font-weight-bold.text-left.text-md-right
						span.d-block.d-md-none Total Input: 
						- var currencyValue = totalIOValues.input;
						include ./value-display.pug
					
			
			

	div.col-lg-6
		- var maxRegularRowCount = (txIOHighlightAddress != null ? config.site.addressPage.txOutputMaxDefaultDisplay : 10000000);
		- var regularRowCount = 0;
		- var hiddenRowCount = 0;
		each vout, voutIndex in tx.vout
			- var highlightRow = false;
			if (txIOHighlightAddress != null && vout.scriptPubKey && vout.scriptPubKey.addresses && vout.scriptPubKey.addresses[0] == txIOHighlightAddress)
				- highlightRow = true;

			if (!highlightRow)
				- regularRowCount++;

			- var hiddenRow = false;
			if (!highlightRow && regularRowCount > maxRegularRowCount)
				- hiddenRow = true;
				- hiddenRowCount++;

			div(data-txid=tx.txid, class=(hiddenRow ? "d-none" : ""))
				div.clearfix
					div.tx-io-label
						a(data-toggle="tooltip", title=("Output #" + voutIndex.toLocaleString()), style="white-space: nowrap;")
							span.font-weight-bold &lt; 
							small.d-inline.d-md-none Output 
							
							if (tx.vout.length > 999)
								small.word-wrap ##{voutIndex}
							else
								span ##{voutIndex.toLocaleString()}
							
							if (tx.vout.length > 0)
								small.d-inline.d-md-none.font-weight-light.text-muted  / #{(tx.vout.length - 1).toLocaleString()}

					div.tx-io-content
						div.clearfix
							div.tx-io-desc
								if (vout.scriptPubKey)
									if (vout.scriptPubKey.addresses)
										if (true)
											div.mb-tiny
												small.data-tag.bg-dark
													span(title=`Output Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-toggle="tooltip") #{utils.outputTypeAbbreviation(vout.scriptPubKey.type)}

										each addr in vout.scriptPubKey.addresses
											a(id=("output-" + voutIndex), href=("./address/" + addr))
												span.text-monospace.word-wrap(class=(highlightRow ? "font-weight-bold" : "")) #{addr}

											if (global.specialAddresses[addr])
												- var specialAddressInfo = global.specialAddresses[addr];
												if (specialAddressInfo.type == "minerPayout")
													span  
													a(data-toggle="tooltip", title=("Miner payout address: " + specialAddressInfo.minerInfo.name))
														i.fas.fa-certificate.text-primary

											br

									else if (vout.scriptPubKey.hex && vout.scriptPubKey.hex.startsWith('6a24aa21a9ed'))
										div.mb-tiny
											small.data-tag.bg-primary OP_RETURN
										
										div
											small.text-muted (SegWit committment - 
												a(href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#commitment-structure", data-toggle="tooltip", title="View developer docs", target="_blank") about
												span )

											br
											small
												a(href="javascript:void(0)" onclick=`$('#op-return-hex-${tx.txid}-${vout.n}').show(); $(this).hide(); return false;`) show raw

										div(id=`op-return-hex-${tx.txid}-${vout.n}`, style="display: none;")
											small.font-weight-bold data
											small (hex) - 
											small.word-wrap #{vout.scriptPubKey.asm}

									else if (vout.scriptPubKey.asm && vout.scriptPubKey.asm.startsWith('OP_RETURN '))
										div.mb-tiny
											small.data-tag.bg-primary OP_RETURN
										
										div
											small.font-weight-bold data
											small (ascii) - 
											small #{utils.hex2ascii(vout.scriptPubKey.asm.substring("OP_RETURN ".length))}
											br
											small
												a(href="javascript:void(0)" onclick=`$('#op-return-hex-${tx.txid}-${vout.n}').show(); $(this).hide(); return false;`) show raw

										div(id=`op-return-hex-${tx.txid}-${vout.n}`, style="display: none;")
											small.font-weight-bold data
											small (hex) -  
											small.word-wrap #{vout.scriptPubKey.asm}



									else
										div.mb-tiny
											small.data-tag.bg-dark
												span(title=`Output Type: ${utils.outputTypeName(vout.scriptPubKey.type)}`, data-toggle="tooltip") #{utils.outputTypeAbbreviation(vout.scriptPubKey.type)}

										div
											small.font-weight-bold asm
											br
											small.word-wrap #{vout.scriptPubKey.asm}
										
										div
											small.font-weight-bold hex
											br
											small.word-wrap #{vout.scriptPubKey.hex}

							div.tx-io-value
								if (utxos)
									if (utxos[voutIndex])
										i.fas.fa-lock.text-success.mr-2(title="Unspent output." data-toggle="tooltip")

									else if (utxos[voutIndex] == null)
										i.fas.fa-lock-open.text-secondary.mr-2(title="Spent output." data-toggle="tooltip")

								- var currencyValue = vout.value;
								include ./value-display.pug


				hr

		if (hiddenRowCount > 0)
			a(href="javascript:void(0)", onclick=("showAllTxOutputs(this, '" + tx.txid + "');")) Show all #{tx.vout.length.toLocaleString()} outputs

		div.row.mb-0.mb-lg-0
			div.col
				div.font-weight-bold.text-left.text-md-right
					span.d-block.d-md-none Total Output: 
					- var currencyValue = totalIOValues.output;
					include ./value-display.pug


